package com.ruoyi.biz.report.letter.controller;

import com.ruoyi.biz.report.letter.service.CategoryReportService;
import com.ruoyi.biz.report.letter.service.HotlineReportService;
import com.ruoyi.biz.report.letter.service.MessageReportService;
import com.ruoyi.biz.report.letter.service.RecordReportService;
import com.ruoyi.biz.report.letter.vo.CategoryReportReq;
import com.ruoyi.biz.report.letter.vo.LeaderMailboxReportResp;
import com.ruoyi.biz.report.letter.vo.RecordLetterReportReq;
import com.ruoyi.common.core.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Fei.Cong
 * @date 2024-08-20 16:17
 */
@RestController
@RequestMapping("/letter/report")
@RequiredArgsConstructor
public class JmReportController {
    private final CategoryReportService categoryReportService;
    private final HotlineReportService hotlineReportService;
    private final RecordReportService recordReportService;
    private final MessageReportService messageReportService;

    @GetMapping("/mailbox/summary")
    public R mailboxReport(CategoryReportReq categoryReportReq) {
        return R.ok(categoryReportService.getMailboxReport(categoryReportReq));
    }

    @GetMapping("/year/category/summary")
    public R yearCategory(CategoryReportReq categoryReportReq) {
        return R.ok(categoryReportService.getReportGroupByMonthAndCategory(categoryReportReq));
    }

    /**
     *  热线，地市/分类统计
     */
    @GetMapping("/hotline/city/category/summary")
    public R hotlineCityCategory(CategoryReportReq categoryReportReq) {
        return R.ok(hotlineReportService.getReportGroupByCityAndCategory(categoryReportReq));
    }

    /**
     * 热线，月份/城市
     * @param categoryReportReq
     * @return
     */
    @GetMapping("/hotline/year/city/summary")
    public R hotlineYearCity(CategoryReportReq categoryReportReq) {
        return R.ok(hotlineReportService.selectReportGroupMonthAndCity(categoryReportReq));
    }
    /**
     *  热线，月份/分类统计
     */
    @GetMapping("/hotline/year/category/summary")
    public R hotlineYearCategory(CategoryReportReq categoryReportReq) {
        return R.ok(hotlineReportService.getReportGroupByMonthAndCategory(categoryReportReq));
    }

    @GetMapping("/record/city/category/summary")
    public R recordCityCategory(CategoryReportReq reportReq) {
        return R.ok(recordReportService.getReportGroupByCityAndCategory(reportReq));
    }

    @GetMapping("/record/year/city/summary")
    public R recordYearCity(CategoryReportReq reportReq) {
        return R.ok(recordReportService.selectReportGroupMonthAndCity(reportReq));
    }

    @GetMapping("/record/year/category/summary")
    public R recordYearCategory(CategoryReportReq reportReq) {
        return R.ok(recordReportService.getReportGroupByMonthAndCategory(reportReq));
    }

    @GetMapping("/message/city/category/summary")
    public R messageCityCategory(CategoryReportReq reportReq) {
        return R.ok(messageReportService.getReportGroupByCityAndCategory(reportReq));
    }

    @GetMapping("/message/year/city/summary")
    public R messageYearCity(CategoryReportReq reportReq) {
        return R.ok(messageReportService.selectReportGroupMonthAndCity(reportReq));
    }

    @GetMapping("/message/year/category/summary")
    public R messageYearCategory(CategoryReportReq reportReq) {
        return R.ok(messageReportService.getReportGroupByMonthAndCategory(reportReq));
    }
}
